<template>
  <div>
    管理员订单详情
    <div>订单号：{{ orderObj.id }}</div>
    <div>收货人：{{ orderObj.receiverName }}</div>
    <div>送货地址：{{ orderObj.receiverAddr }}</div>
    <div>收货人电话：{{ orderObj.receiverPhone }}</div>
    <div>下单时间：{{ orderObj.orderDate }}</div>
    <div>订单总价：{{ orderObj.sumPrice }}</div>
    <div>订单状态：{{ orderObj.status }}</div>
    订单明细
    <el-table :data="orderObj.detailList" border style="width: 100%">
      <el-table-column prop="product.id" label="商品编号" width="180"/>
      <el-table-column prop="product.name" label="商品名"/>
      <el-table-column prop="product.price" label="单价"/>
      <el-table-column prop="buyNum" label="购买数量"/>
    </el-table>
    <el-button type="primary" @click="send(orderObj.id)">发货</el-button>
    <el-button type="primary" @click="$router.push('/manageOrder')">返回</el-button>

  </div>
</template>

<script>
import axios from "axios";

export default {
  data() {
    return {
      id: "",
      orderObj: {},
    }
  },
  created() {
    this.id = this.$route.query.orderId;
    this.findByOrderId();
  },
  methods: {
    findByOrderId() {
      axios.get("/project/order/findByOrderId", {
        params: {
          orderId: this.id,
        }
      }).then(resp => {
        this.orderObj = resp.data;
      })
    },
    send() {
      axios.get("/project/order/send", {
        params: {
          orderId: this.id,
        }
      }).then(resp => {
        if (resp.data == "ok") {
          this.$router.push("/manageOrder");
        }
      })
    },
  }
}

</script>

<style scoped>

</style>